package com.framework.controller;

import java.util.List;
import java.util.Set;

import com.framework.core.domain.BaseControl;
import com.framework.core.myannotation.MyAutowire;
import com.framework.core.myannotation.MyController;
import com.framework.core.myannotation.MyRequestMapping;
import com.framework.domain.UserInformation;
import com.framework.service.LoginRegisterService;

/**
 * Controller测试
 * 
 * @author Rose 2017年9月18日
 */
@MyController
public class LoginRegisterController extends BaseControl {

	@MyAutowire
	private LoginRegisterService loginRegisterService;

	@MyRequestMapping("/login")
	public String login(String s, Integer i) {
		System.out.println("请求参数----" + getRequest().getParameter("base") + "-----");
		getRequest().setAttribute("hehe", s + "=" + i);
		UserInformation result = loginRegisterService.login("pakho", "123456");
		getRequest().setAttribute("result", result);
		return "index";
	}

	@MyRequestMapping("/list")
	public String check() {
		List<UserInformation> list = loginRegisterService.list();
		getRequest().setAttribute("list", list);
		return "error";
	}
	@MyRequestMapping("/set")
	public String set() {
		Set<String> set = loginRegisterService.set();
		getRequest().setAttribute("list", set);
		return "error";
	}
	@MyRequestMapping("/string")
	public String testString(String pwd) {
		String s=loginRegisterService.selectString(pwd);
		getRequest().setAttribute("string", s);
		return "index";
	}
	@MyRequestMapping("/long")
	public String testLong(String pwd) {
		Long l=loginRegisterService.selectLong(pwd);
		getRequest().setAttribute("longg", l);
		return "index";
	}

	// public void setLoginRegisterService(LoginRegisterService
	// loginRegisterService) {
	// this.loginRegisterService = loginRegisterService;
	// }

}
